# Please refer to the Plain Old Documentation (POD) at the end of this Perl Script for further information

my $VERSION = "0.0.1"; # May be required to upload script to CPAN i.e. http://www.cpan.org/scripts/submitting.html

$site = $ARGV[0];

$shell_script_filename = "tit-kludge.sh";

open( SHELL_SCRIPT, ">./$shell_script_filename" );
print SHELL_SCRIPT "#!/bin/sh\n";
print SHELL_SCRIPT "echo\n";
print SHELL_SCRIPT "echo The created shell script assumes that the value of \"Total\" is per the value returned by the Bing API\n";
print SHELL_SCRIPT "echo\n";
print SHELL_SCRIPT "echo PRESS ANY KEY TO CONTINUE\n";
print SHELL_SCRIPT "read -n 1 -s\n";

print SHELL_SCRIPT ("./tit.pl -site $site -offset $starting_bing_offset\n");

for (my $starting_bing_offset=50; $starting_bing_offset <= 950; ($starting_bing_offset = $starting_bing_offset + 50)) {
	print SHELL_SCRIPT ("./tit.pl -site $site -offset $starting_bing_offset -quiet\n");
	print SHELL_SCRIPT ("sleep 1\n");
}

print SHELL_SCRIPT ("echo\necho\n");

system ("chmod u+x ./$shell_script_filename\n");
close SHELL_SCRIPT;

# TODO Removing duplicate lines from ./[query]/tit/bing

=head1 NAME

tit-kludge.pl - "TCP Input Text"

=head1 VERSION

This documentation refers to tit-kludge.pl v0.0.1

=head1 CONFIGURATION

=head1 USAGE

perl tit-kludge.pl '[Domain Name]'

=head1 REQUIRED ARGUEMENTS

'[Domain Name]' e.g. 'tcpinputtext.org' enclosed in single quotes

=head1 OPTIONAL ARGUEMENTS

=head1 DESCRIPTION

Kludge for "TCP Input Text" to workaround to return all 1K Bing search results

=head1 DEPENDENCIES

=head1 PREREQUISITES

=head1 COREQUISITES

=head1 OSNAMES

osx

=head1 SCRIPT CATEGORIES

Web

=head1 INCOMPATIBILITIES

=head1 BUGS AND LIMITATIONS

Please refer to the comments beginning with "TODO" in the Perl Code

=head1 AUTHOR

Christian Heinrich

=head1 CONTACT INFORMATION

http://cmlh.id.au/contact

=head1 MAILING LIST

=head1 REPOSITORY

http://tit.codeplex.com/

=head1 FURTHER INFORMATION AND UPDATES

http://tcpinputtext.org
http://del.icio.us/cmlh/tit

=head1 LICENSE AND COPYRIGHT

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. 

Copyright 2008-2012 Christian Heinrich